
#if 1
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)

#include "OFJNIFunctions.h"
#include "platform/android/jni/JniHelper.h"
#include <jni.h>

using namespace cocos2d;

void OFJNIFunctions::showLeaderBoards()
{
    JniMethodInfo t;

    if( JniHelper::getStaticMethodInfo( t, "com/ijoyplay/tetris/TetrisAndroid", "showLeaderBoards", "()V" ) )
    {
        t.env->CallStaticVoidMethod( t.classID, t.methodID );
        t.env->DeleteLocalRef( t.classID );
    }
}

void OFJNIFunctions::showAchievements()
{
    JniMethodInfo t;

    if( JniHelper::getStaticMethodInfo( t, "com/ijoyplay/tetris/TetrisAndroid", "showAchievements", "()V" ) )
    {
        t.env->CallStaticVoidMethod( t.classID, t.methodID );
        t.env->DeleteLocalRef( t.classID );
    }
}

void OFJNIFunctions::showDashBoards()
{
    JniMethodInfo t;

    if( JniHelper::getStaticMethodInfo( t, "com/ijoyplay/tetris/TetrisAndroid", "showDashBoards", "()V" ) )
    {
        t.env->CallStaticVoidMethod( t.classID, t.methodID );
        t.env->DeleteLocalRef( t.classID );
    }
}

void OFJNIFunctions::submitScores( int scores )
{
    JniMethodInfo t;

    if( JniHelper::getStaticMethodInfo( t, "com/ijoyplay/tetris/TetrisAndroid", "submitScores", "(I)V" ) )
    {
        t.env->CallStaticVoidMethod( t.classID, t.methodID, scores );
    }
}


void OFJNIFunctions::setAdViewVisible( int isVisible )
{
    JniMethodInfo t;

    if( JniHelper::getStaticMethodInfo( t, "com/ijoyplay/tetris/TetrisAndroid", "setAdViewVisible", "(I)V" ) )
    {
        t.env->CallStaticVoidMethod( t.classID, t.methodID, isVisible );
    }
}


void OFJNIFunctions::unlockAchievements( const char * achievementid )
{
    JniMethodInfo t;

    if( JniHelper::getStaticMethodInfo( t, "com/ijoyplay/tetris/TetrisAndroid", "unlockAchievements", "(Ljava/lang/String;)V" ) )
    {
        jstring stringArg1 = t.env->NewStringUTF( achievementid );
        t.env->CallStaticVoidMethod( t.classID, t.methodID, stringArg1);
        t.env->DeleteLocalRef( stringArg1 );
        t.env->DeleteLocalRef( t.classID );
    }
}

void OFJNIFunctions::openURL( const char * url )
{
    JniMethodInfo t;

    if( JniHelper::getStaticMethodInfo( t, "com/ijoyplay/tetris/TetrisAndroid", "openURL", "(Ljava/lang/String;)V" ) )
    {
        jstring stringArg1 = t.env->NewStringUTF( url );
        t.env->CallStaticVoidMethod( t.classID, t.methodID, stringArg1);
        t.env->DeleteLocalRef( stringArg1 );
        t.env->DeleteLocalRef( t.classID );
    }
}
#endif // CC_PLATFORM_ANDROID
#endif